package com.platform.hjt.erp.model.json;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializerProvider;

import com.platform.hjt.erp.model.ErpGoodInfo;

public class ErpGoodInfoSerializer  extends JsonSerializer<ErpGoodInfo>{

	@Override
	public void serialize(ErpGoodInfo erpGoodInfo, JsonGenerator jgen,
			SerializerProvider arg2) throws IOException,
			JsonProcessingException {
		ObjectMapper om = new ObjectMapper();
		Map<String, String> map = new HashMap<String, String>();
		map.put("erpGoodInfoId", erpGoodInfo.getErpGoodInfoId());
		map.put("goodName", erpGoodInfo.getGoodName());
		map.put("goodUnit", erpGoodInfo.getGoodUnit());
		map.put("fullPinyin", erpGoodInfo.getFullPinyin());
		map.put("goodCode", erpGoodInfo.getGoodCode());
		map.put("shortPinyin", erpGoodInfo.getShortPinyin());
		map.put("goodSellPrice", erpGoodInfo.getGoodSellPrice().toString());
		map.put("goodCostPrice", erpGoodInfo.getGoodCostPrice().toString());
		om.writeValue(jgen, map);
		
	}

}
